<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasAlignText;
use LowCode\Traits\Props\HasType;

/**
 * h1-h6标签
 * @method static Title make(mixed $children = null, int $level = 1) H组件
 */
class Title extends Naive
{
    use HasType, HasAlignText;

    /**
     * @param mixed|null $children
     * @param int $level
     */
    public function __construct(mixed $children = null, int $level = 1)
    {
        parent::__construct();
        $this->level($level)->children($children);
    }

    /**
     * 在字首显示条块
     * @param int|JsExp $level
     * @return $this
     */
    public function level(int|JsExp $level = 1): static
    {
        return $this->prop('level', $level);
    }

    /**
     * 在字首显示条块
     * @param string|JsExp $prefix 'bar'
     * @return $this
     */
    public function prefix(string|JsExp $prefix = "bar"): static
    {
        return $this->prop('prefix', $prefix);
    }


    /**
     * default
     * @return $this
     */
    public function primary(): static
    {
        return $this->type('default');
    }

    /**
     * default
     * @return $this
     */
    public function default(): static
    {
        return $this->type('default');
    }
}
